Skip to content

Conversation

@bjornjorgensen
Copy link
Contributor

What changes were proposed in this pull request?

Rename self to cls

Why are the changes needed?

Function def train(self....) is decorated as a @classmethod

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Pass existed tests.

@bjornjorgensen bjornjorgensen changed the title [SPARK-39113] Rename self to cls in mllib/clustering [SPARK-39113][CORE][MLLIB][PYTHON] Rename self to cls in mllib/clustering May 6, 2022
@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@Yikun
Copy link
Member

Yikun commented May 7, 2022

I'm fine with it. This is not mandatory but it's suggestion from pep8.

[1] https://peps.python.org/pep-0008/#function-and-method-arguments

# grep -R "@classmethod" **/*.py -A2 | grep self
python/pyspark/mllib/clustering.py-        self,
python/pyspark/testing/sqlutils.py-    def sqlType(self):
python/pyspark/testing/sqlutils.py-    def sqlType(self):

Then, let's also fix other style error together.

@bjornjorgensen bjornjorgensen changed the title [SPARK-39113][CORE][MLLIB][PYTHON] Rename self to cls in mllib/clustering [SPARK-39113][CORE][MLLIB][PYTHON] Rename self to cls May 7, 2022
@srowen
Copy link
Member

srowen commented May 7, 2022

Are there any other cases?

@bjornjorgensen
Copy link
Contributor Author

bjornjorgensen commented May 7, 2022

Thank you @Yikun
What tool are you using?

@srowen Not that I can find.

I'm using sonarqube but I can't search after only this one thing.

@Yikun
Copy link
Member

Yikun commented May 7, 2022

@bjornjorgensen No tool in here, just a script as I mentioned in last comment: grep -R "@classmethod" **/*.py -A2 | grep self

@srowen
Copy link
Member

srowen commented May 8, 2022

Merged to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants